package com.oa.co.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oa.co.mapper.RepairMapper;
import com.oa.co.pojo.Reissue_card;
import com.oa.co.service.RepairService;
import com.oa.co.vo.PerformanceBarVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("repairService")
public class RepairServiceImpl implements RepairService {

    @Autowired
    private RepairMapper repairMapper;
    @Override
    public PageInfo<Reissue_card> selectRepairList(Integer page, Integer limit, String applicant, String subordinate_department) {

        Reissue_card reissue_card = new Reissue_card();
        reissue_card.setApplicant(applicant);
        reissue_card.setSubordinate_department(subordinate_department);

        if(page != null && limit != null){
            PageHelper.startPage(page,limit);
            List<Reissue_card> performances = repairMapper.selectRepairList(reissue_card);
            PageInfo<Reissue_card> pageInfo = new PageInfo<>(performances);
            return pageInfo;
        }else {
            List<Reissue_card> performances = repairMapper.selectRepairList(reissue_card);
            PageInfo<Reissue_card> pageInfo = new PageInfo<>(performances);
            return pageInfo;
        }
    }

    @Override
    public int delRapair(Integer id) {
        return repairMapper.delRapair(id);
    }

    @Override
    public int repairEdit(Reissue_card reissue_card) {
        return repairMapper.repairEdit(reissue_card);
    }

    @Override
    public int repairAdd(Reissue_card reissue_card) {
        return repairMapper.repairAdd(reissue_card);
    }

    @Override
    public int delAllRepair(List<Integer> list) {
        return repairMapper.delAllRepair(list);
    }

    @Override
    public List<PerformanceBarVo> repairBarData() {
        return repairMapper.repairBarData();
    }

    @Override
    public List<PerformanceBarVo> repairPieData() {
        return repairMapper.repairPieData();
    }
}
